

* Add your folders here: 
*global data = "C:\Users\andrkot\Frischsenteret Dropbox\Andreas Kotsadam\Mili_madla\Democracy\Final submission\round4\replication\Replication_data"
*global replication = "C:\Users\andrkot\Frischsenteret Dropbox\Andreas Kotsadam\Mili_madla\Democracy\Final submission\round4\replication\Results"


global data = "C:\Users\andrkot\Dropbox (Frischsenteret)\Mili_madla\Democracy\Final submission\round4\replication\Replication_data"
global replication = "C:\Users\andrkot\Dropbox (Frischsenteret)\Mili_madla\Democracy\Final submission\round4\replication\Results"





* Install necessary programs
*ssc install sankey_plot
*ssc install cibar


/*
We start with the main tables, followed by the main figures. 
These two also produce separate logfiles. 

We then run all analyses for the supplementary appendix and create a log file for these as well. 

*/



 
 * ---------------------------------------------------------------------
* 0.  House-keeping
* ---------------------------------------------------------------------
*version 18.5                 
clear all
set more off
set linesize 255         
set graphics on 


graph drop _all
set scheme stcolor


about

 cap log close
 log using "$replication\replication_ajps_main.log", replace
 
 * ---------------------------------------------------------------------
* 1.  TABLES
* ---------------------------------------------------------------------

* Main tables. Stars and format of decimals following AJPS format.

** Table 1:


use "$data\replication_clean.dta", clear

estimates drop _all

* Table 1
foreach var of varlist  military_rule authoritarian_pref political_order ///
///
{
reg  `var' base_auth_a, cl(room) 
	 estadd local Controls "No"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_corr
}

		local varlist ///
base_auth_a   ///
 
cd "$replication"
#delimit;
	noisily esttab military_rule_corr authoritarian_pref_corr political_order_corr 
		using "Table_1.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(† 0.10 * 0.05 ** 0.01) b(2) se(2) 
mtitles("Military rule" "Authoritarian preferences" "Political order")
		keep(`varlist') order(`varlist')
		varlabels(
	base_auth_a "Support for authoritarian rule at baseline"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
* Pvalues for text: 
foreach var of varlist auth_a auth_b military_rule authoritarian_pref political_order ///
///
{
pdslasso  `var'  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
}

** Table 2:

estimates drop _all


foreach var of varlist auth_a auth_b military_rule authoritarian_pref political_order ///
///
{
pdslasso  `var'  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
}


				local varlist ///
	base_oth_r_att   ///
	 
	cd "$replication"
	#delimit;
		noisily esttab auth_a_pds auth_b_pds
			using "Table_2.tex", 
		style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(† 0.10 * 0.05 ** 0.01) b(2) se(2) 
	mtitles("Support for authoritarian rule" "Beliefs about support for authoritarian rule")
			keep(`varlist') order(`varlist')
			varlabels(
		base_oth_r_att "Support for authoritarian rule in the room"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr

* add p-value of RI:
* column 1:		
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_a base_oth_r_att  tr_fe*  m_b_a_a_d1_m m_b_a_a_d3_m m_b_a_a_d4_m, cl(room)

/*
p=c/n= 0.0080
------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1594913       8    1000  0.0080  0.0028    .00346    .015702
------------------------------------------------------------------------------
	   */
	   
* Column 2: 
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_b base_oth_r_att  tr_fe* m_b_a_b_d1_m  m_b_a_b_d2_m m_b_a_b_d4_m  m_b_a_a_d1_m  m_b_a_a_d4_m m_base_high_pol_interest_m, cl(room)


/*
p=c/n= 0.0380

------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1204638      38    1000  0.0380  0.0060  .0270288   .0517871
------------------------------------------------------------------------------

	   */

		
** Table 3:


estimates drop _all




foreach var of varlist auth_a2 auth_b2   ///
///
{
pdslasso  `var'  authoritarian_t  (e_b_* e_a_* m_b* tr_fe*) , robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_pds
}

			local varlist ///
authoritarian_t   ///
 
cd "$replication"
#delimit;
	noisily esttab auth_a2_v_pds auth_b2_v_pds 
		using "Table_3.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(† 0.10 * 0.05 ** 0.01) b(2) se(2) 
	mtitles("Support for authoritarian rule" "Beliefs about support for authoritarian rule")
		keep(`varlist') order(`varlist')
		varlabels(
		authoritarian_t "Authoritarian treatment"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	

* ---------------------------------------------------------------------
* 2.  Figures
* ---------------------------------------------------------------------

graph drop _all
set scheme stcolor

*ssc install sankey_plot
*ssc install cibar

/***********************************************************************
  Re-creates all figures and produces a logfile for
  journal replication materials.
***********************************************************************/


cd "$replication"
graph set window fontface Arial	
* ---------------------------------------------------------------------
* FIGURES
* ---------------------------------------------------------------------

*Figure 1: Support for authoritarian rule and beliefs

use "$data\replication_attrition.dta", clear 
drop if room=="" /* Only for subjects where we have information about rooms*/ 
label define disag_ag1_5b 1 "Strongly disagree"  2 "Disagree" 3 "Neither nor " 4 "Agree"  5 "Strongly agree"
label values base_auth* disag_ag1_5b

twoway ///
(histogram base_auth_a, frac discrete fcolor(white%30) lcolor(black) lwidth(thin) gap()) ///
(histogram base_auth_b, frac discrete fcolor(%50) lcolor(%70) lwidth(thin) gap()), ///
    title("", size(11-pt)) ///
    ytitle("Fraction", size(10-pt)) ///
    xtitle("", size(10-pt)) ///
    legend(position(6) order(1 "Support for authoritarian rule" 2 "Beliefs") ///
           ring(1) cols(1) region(lstyle(none)) size(medsmall)) ///
    plotregion(lcolor(none)) ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
    xlabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither/nor" 4 "Agree" 5 "Strongly agree", ///
    angle() labsize(8-pt) nogrid) ///
	ylabel(0 "0.0" 0.10 "0.1" 0.20 "0.2" 0.30 "0.3" 0.40 "0.4", /// 
	nogrid labsize(8-pt)) ///	
    scheme() xsize(4) ysize(4)  ///
    name(Figure_1_color, replace)
graph export "Figure_1.pdf", replace
	tab base_auth_a 
	tab base_auth_b

**************************************************************************************************************
*Figure 2: Movements in support for authoritarian rule during bootcamp

use "$data\endline_new.dta", clear
label var base_auth_a "Base: Support for authoritarian rule"
label var auth_a "End: Support for authoritarian rule"
label define disag_ag1_5b 1 "Strongly disagree"  2 "Disagree" 3 "Neither/nor " 4 "Agree"  5 "Strongly agree"
label values auth_* base_auth* disag_ag1_5b 

*Variable equal to 1 for those with high levels in the room
tab att_gr_3_3

* First Sankey Plot: Authoritarian Treatment

*Only including values where we have observations at baseline and endline (for those with high levels in the room)
sankey_plot base_auth_a auth_a if att_gr_3_3==1 & base_auth_a!=. & auth_a!=., ///
    wide xlabel(1 "Base" 2 "End", labsize(10-pt)) ///
    title("(a) High levels in the room", size(11-pt)) ///
    gap(0.1) noline colorpalette(d3) labsize(8-pt) labcolor(black) ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
    scheme() name(a, replace)  xsize(2.9) ysize(3)
graph save a, replace

*The raw numbers
tab  base_auth_a auth_a if att_gr_3_3==1 & base_auth_a!=. & auth_a!=., row col 

* Second Sankey Plot: Anti-authoritarian Treatment
sankey_plot base_auth_a auth_a if att_gr_3_3==0 & base_auth_a!=. & auth_a!=., ///
    wide xlabel(1 "Base" 2 "End", labsize(10-pt)) ///
    title("(b) Not high levels in the room", size(11-pt)) ///
    gap(0.1) noline colorpalette(d3) labsize(8-pt) labcolor(black) ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
    scheme() name(b, replace)  xsize(2.9) ysize(3)
graph save b, replace 

* Combine both panels 
graph combine a.gph b.gph, ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
    imargin(2 7 0 2) iscale(1.1)  xsize(7.7) ysize(3.8) ///  
    name(Figure_2_color, replace)
graph export "Figure_2.pdf", replace
*The raw numbers
tab  base_auth_a auth_a if att_gr_3_3==0 & base_auth_a!=. & auth_a!=., row col 

**************************************************************************************************************
*Figure 3: Effects of the authoritarian treatment on the distribution of support for authoritarian rule and beliefs for the military sample.


* Histogram: (a) Support for authoritarian rule
twoway ///
    (histogram auth_a2 if authoritarian_t==0, frac discrete fcolor(white%30) lcolor(black) lwidth(thin) gap()) ///
    (histogram auth_a2 if authoritarian_t==1, frac discrete fcolor(%50) lcolor(black) lwidth(thin) gap()), ///
    title("(a) Support for authoritarian rule", size(11-pt)) ///
    ytitle("Fraction", size(10-pt)) ///
    xtitle("", size(10-pt)) ///
    legend(order(1 "Anti-authoritarian treatment" 2 "Authoritarian treatment") ///
    pos(6) ring(1) cols(1) region(lstyle(none)) size(10-pt)) ///
    plotregion(lcolor(white)) graphregion(fcolor(white) lcolor(white)) ///
    xlabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither nor" 4 "Agree" 5 "Strongly agree", angle() ///
	labsize(8-pt) nogrid) ylabel(, nogrid angle(horizontal)) ///
    ylabel(0 "0.0" 0.10 "0.1" 0.20 "0.2" 0.30 "0.3" 0.40 "0.4" 0.50 "0.5", /// 
	nogrid labsize(8-pt)) xsize(4.5) ysize(4.1)   ///	
    name(a, replace) 
graph save a, replace
graph export "Figure_3a.png", replace

tab auth_a2 if authoritarian_t==0
tab auth_a2 if authoritarian_t==1

* Histogram: (b) Beliefs about support
twoway ///
   (histogram auth_b2 if authoritarian_t==0, frac discrete fcolor(white%30) lcolor(black) lwidth(thin) gap()) ///
    (histogram auth_b2 if authoritarian_t==1, frac discrete fcolor(%50) lcolor(black) lwidth(thin) gap()), ///
    title("(b) Beliefs about support", size(11-pt)) ///
    ytitle("Fraction", size(10-pt)) ///
    xtitle("", size(10-pt)) ///
    legend(order(1 "Anti-authoritarian treatment" 2 "Authoritarian treatment") ///
    pos(6) ring(1) cols(1) region(lstyle(none)) size(10-pt)) ///
    plotregion(lcolor(white)) graphregion(fcolor(white) lcolor(white)) ///
    xlabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither nor" 4 "Agree" 5 "Strongly agree", angle() ///
	labsize(8-pt) nogrid) ylabel(, nogrid angle(horizontal)) ///
    ylabel(0 "0.0" 0.10 "0.1" 0.20 "0.2" 0.30 "0.3" 0.40 "0.4" 0.50 "0.5", /// 
	nogrid labsize(8-pt)) xsize(4.5) ysize(4.1)  ///	
    name(b, replace)
graph save b, replace
graph export "Figure_3b.png", replace


* Combine both graphs with shared legend
grc1leg a.gph b.gph, ///
    ycommon xcommon ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
    imargin(0 0 0 0)  ///  
    xsize(9) ysize(12) ///
    scale(1.2) ///
    name(Figure_3_color, replace)
graph export "Figure_3.pdf", replace

tab auth_b2 if authoritarian_t==0
tab auth_b2 if authoritarian_t==1

**************************************************************************************************************
*Figure 4: Movements in support for authoritarian rule in the endline survey by treatment.

* First Sankey Plot: Authoritarian Treatment
sankey_plot auth_a auth_a2 if authoritarian_t == 1 & base_auth_a != . & auth_a != ., ///
    wide xlabel(1 "Before" 2 "After", labsize(10-pt)) ///
    title("(a) Authoritarian treatment", size(11-pt)) ///
    gap(0.1) noline colorpalette(d3) labsize(8-pt) labcolor(black) ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
	name(a, replace)  xsize(2.9) ysize(3)
graph save a, replace

tab auth_a auth_a2 if authoritarian_t == 1 & base_auth_a != . & auth_a != ., row col


* Second Sankey Plot: Anti-authoritarian Treatment
sankey_plot auth_a auth_a2 if authoritarian_t == 0 & base_auth_a != . & auth_a != ., ///
    wide xlabel(1 "Before" 2 "After", labsize(10-pt)) ///
    title("(b) Anti-authoritarian treatment", size(11-pt)) ///
    gap(0.1) noline colorpalette(d3) labsize(8-pt) labcolor(black) ///
    graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
	name(b, replace)  xsize(2.9) ysize(3)
graph save b, replace

tab auth_a auth_a2 if authoritarian_t == 0 & base_auth_a != . & auth_a != ., 


* Combine both panels into one figure (scale(1.3)
graph combine a.gph b.gph, ///
    graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
    imargin(0 0 0 0) iscale(1) ///  
    name(Figure_4_color, replace)

* Export
graph export "Figure_4.pdf", replace



**************************************************************************************************************
*Figure 5: Difference across samples in support for authoritarian rule.
use "$data\replication_genpop.dta", clear
set scheme stcolor

* Set global font
graph set window fontface "Arial"

keep auth_a no_t 
keep  if no_t==1
tempfile genpop
save `genpop'

use "$data\endline_new.dta", clear
keep base_auth_a
rename base_auth_a auth_a
gen mili=1
append using `genpop'
replace mili=0 if mili==.

* Label definition for mili variable, if not already labeled
label define mili_lbl 0 "Control group in general survey" 1 "Baseline answers in Military Sample", replace
label values mili mili_lbl


*CIBAR figure: Support for authoritarian rule
cibar auth_a, over(mili) ///
    barcolor(stblue%90 gs6%30) ///
    ciopts(lcolor(black) lwidth(medthin)) ///
    bargap(0) ///
    graphopts( ///
        title("", size(11-pt)) ///
        ytitle("Support for authoritarian rule", size(10-pt)) ///
      ylabel(1.00 "1.0" 1.50 "1.5" 2.00 "2.0" 2.50 "2.5" 3.00 "3.0", nogrid angle() labsize(8-pt)) ///		
        xlabel(, nogrid labsize(8-pt)) ///
        legend(order(1 "Control group in general survey" 2 "Baseline answers in military sample") ///
               pos(6) ring(1) cols(1) bplacement(s) region(lstyle(none)) size(medsmall)) ///
        graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
        plotregion(lcolor(white)) ///
        scheme() xsize(2.9) ysize(3)  ///
        name(Figure_5_color, replace) ///
    )
graph export "Figure_5.pdf", replace
bysort mili: ci mean auth_a


***********************************************************************************************
*Figure 6: Comparison of support for authoritarian rule by treatment in the general population.

use "$data\replication_genpop.dta", clear

* Set global font
graph set window fontface "Arial"

*Bar chart with confidence intervals
cibar auth_a, over(qsplit) ///
    barcolor(stblue%100 stblue%50 stblue%20) ///
    ciopts(lcolor(black) lwidth(medthin)) ///
    bargap(0) ///
    blfmt(%4.2f) ///
    graphopts( ///
        title("", size(11-pt)) ///
        ytitle("Support for authoritarian rule", size(10-pt)) ///
        ylabel(1.00 "1.0" 1.50 "1.5" 2.00 "2.0" 2.50 "2.5" 3.00 "3.0", nogrid angle(horizontal) labsize(8-pt)) ///
        xlabel(, nogrid labsize(8-pt)) ///
        legend(order(1 "Authoritarian treatment" 2 "Anti-authoritarian treatment" 3 "No treatment") ///
               pos(6) ring(1) cols(1) bplacement(s) region(lstyle(none)) size(medsmall)) ///
        graphregion(fcolor(none) lcolor(none) ifcolor(none) ilcolor(none)) ///
        plotregion(lcolor(none)) ///
        scheme() xsize(2.9) ysize(3)     ///
        name(Figure_6_color, replace) ///
    )
	graph export "Figure_6.pdf", replace
bysort qsplit: ci mean auth_a

graph close a b

log close
						   

 
 

 cap log close
 log using "$replication\replication_ajps_appendix.log", replace	
 
  * ---------------------------------------------------------------------
* 3.  Online appendix 
* ---------------------------------------------------------------------

* Format follows our own preference. In particular regarding stars and number of decimals of standard errors.
* 	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se 
	

** Table A1:

	use "$data\replication_attrition.dta", clear
estimates drop _all

foreach var of varlist attrit ///
///
{
pdslasso  `var'  base_oth_r_att  (m_* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
reg  `var' base_oth_r_att i.troop m_b_a_a_*, cl(room) 
 estadd local Controls "Necessary"
 su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_tr
reg  `var' base_oth_r_att m_* i.troop, cl(room) 
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_full
}


foreach var of varlist attrit ///
///
{
			local varlist ///
base_oth_r_att   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'* 
		using "`var'.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	




** Table A2:
	use "$data\replication_clean.dta", clear
estimates drop _all



* Main:
pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo cc1
* change score:
* Very similar:
pdslasso  diff_a  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo cc2
reg diff_a  base_oth_r_att  tr_fe*, cl(room)
	 estadd local Controls "Troop"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo cc3

				local varlist ///
	base_oth_r_att   ///
	 
	cd "$replication"
	#delimit;
		noisily esttab cc*
			using "peer_cc.tex", 
		style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("Main specification" "Change scores" "Change scores")
			keep(`varlist') order(`varlist')
			varlabels(
		base_oth_r_att "Support for authoritarian rule in the room"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr
		
		

** Table A3 

estimates drop _all

foreach var of varlist auth_a  ///
///
{
pdslasso  `var'  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
reg  `var' base_oth_r_att i.troop base_auth_a  m_b_a_a_*, cl(room) 
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_tr
reg  `var' base_oth_r_att m_b* i.troop, cl(room) 
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_full
}


foreach var of varlist auth_a   ///
///
{
			local varlist ///
base_oth_r_att   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'* 
		using "`var'.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	

* Add randomization inference p-value 
* column 1
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_a base_oth_r_att  tr_fe*  m_b_a_a_d1_m m_b_a_a_d3_m m_b_a_a_d4_m, cl(room)

/*
p=c/n= 0.0080
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1594238       8    1000  0.0080  0.0028    .00346    .015702


	   */

* column 2
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_a base_oth_r_att  m_b_a_a_* tr_fe*, cl(room)
/*
p=c/n= 0.0080

T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1594238       8    1000  0.0080  0.0028    .00346    .015702

*/	   
* column 3
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_a base_oth_r_att  m_b* tr_fe*, cl(room)
/*
p=c/n= 0.0360
------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1213612      36    1000  0.0360  0.0059  .0253389   .0494929
------------------------------------------------------------------------------



*/

* Table A4:

foreach var of varlist auth_b  ///
///
{
pdslasso  `var'  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
reg  `var' base_oth_r_att i.troop base_auth_a  m_b_a_a_*, cl(room) 
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_tr
reg  `var' base_oth_r_att m_b* i.troop, cl(room) 
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_full
}


foreach var of varlist auth_b   ///
///
{
			local varlist ///
base_oth_r_att   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'* 
		using "`var'.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	

* Add randomization inference p-value 
* column 1
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_b base_oth_r_att  tr_fe* m_b_a_b_d1_m  m_b_a_b_d2_m m_b_a_b_d4_m  m_b_a_a_d1_m  m_b_a_a_d4_m m_base_high_pol_interest_m, cl(room)

/*
------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1204638      38    1000  0.0380  0.0060  .0270288   .0517871
------------------------------------------------------------------------------

	  */


* column 2
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_b base_oth_r_att  m_b_a_a_* tr_fe*, cl(room)
/*

------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |    .148494      18    1000  0.0180  0.0042  .0107019    .028299
------------------------------------------------------------------------------



*/	   

* column 3
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_b base_oth_r_att  m_b* tr_fe*, cl(room)
/*
------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1043437      97    1000  0.0970  0.0094  .0793645   .1170478
------------------------------------------------------------------------------

*/	  

		
** Table A5:

pdslasso  auth_a  base_oth_r_att  oth_r_base_auth_b  z_oth_r_base_female z_oth_r_base_hpi  z_oth_r_base_high_grade  z_oth_r_base_mother_edu  z_oth_r_base_father_edu  z_oth_r_base_plan_edu  z_oth_r_base_high_risk  z_oth_r_base_high_trust  z_oth_r_base_vote  z_oth_r_base_AP  z_oth_r_base_H  z_oth_r_base_FRP  z_oth_r_base_V  z_oth_r_base_SV  z_oth_r_base_Other  z_oth_r_base_Unknown   (m_b* tr_fe*) , partial(tr_fe*) cl(room)	
		 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo oc_auth_a_pds


pdslasso  auth_a  base_oth_r_att  oth_r_base_auth_b  z_oth_r_base_female z_oth_r_base_hpi  z_oth_r_base_high_grade  z_oth_r_base_mother_edu  z_oth_r_base_father_edu  z_oth_r_base_plan_edu  z_oth_r_base_high_risk  z_oth_r_base_high_trust  z_oth_r_base_vote  z_oth_r_base_AP  z_oth_r_base_H  z_oth_r_base_FRP  z_oth_r_base_V  z_oth_r_base_SV  z_oth_r_base_Other  z_oth_r_base_Unknown  z_oth_r_base_g_defense z_oth_r_base_g_hh z_oth_r_base_i_refugee z_oth_r_base_red_tax z_oth_r_base_red_prop z_oth_r_base_exp_school z_oth_r_base_exp_conscr z_oth_r_base_team_person z_oth_r_base_team_gender z_oth_r_base_red_unemp z_oth_r_base_immigrant (m_b* tr_fe*) , partial(tr_fe*) cl(room)
			 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo oc2_auth_a_pds

local varlist ///
base_oth_r_att  oth_r_base_auth_b z_oth_r_base_female z_oth_r_base_hpi  z_oth_r_base_high_grade  z_oth_r_base_mother_edu  z_oth_r_base_father_edu  z_oth_r_base_plan_edu  z_oth_r_base_high_risk  z_oth_r_base_high_trust  z_oth_r_base_vote  z_oth_r_base_AP   z_oth_r_base_FRP  z_oth_r_base_V  z_oth_r_base_SV  z_oth_r_base_Other  z_oth_r_base_Unknown z_oth_r_base_g_defense z_oth_r_base_g_hh z_oth_r_base_i_refugee z_oth_r_base_red_tax z_oth_r_base_red_prop z_oth_r_base_exp_school z_oth_r_base_exp_conscr z_oth_r_base_team_person z_oth_r_base_team_gender z_oth_r_base_red_unemp z_oth_r_base_immigrant ///
 
 
cd "$replication"
#delimit;
	noisily esttab oc_auth_a_pds oc2_auth_a_pds
		using "control_other_room2.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("Attitudes" "Attitudes")
		keep(`varlist') order(`varlist')
		varlabels(
		  base_oth_r_att "Support for authoritarian rule in the room"
	 oth_r_base_auth_b "Beliefs about support in the room"
	  z_oth_r_base_female "Share Female"
  z_oth_r_base_hpi "Share High political interest" 
  z_oth_r_base_high_grade "Share High GPA" 
  z_oth_r_base_mother_edu "Share Mother with high education"
  z_oth_r_base_father_edu "Share Father with high education"
  z_oth_r_base_plan_edu "Share Plan higher education"
  z_oth_r_base_high_risk "Share High risk"
  z_oth_r_base_high_trust "Share High trust"
  z_oth_r_base_vote  "Share Vote"
  z_oth_r_base_AP "Share: Labour"  
  z_oth_r_base_FRP "Share: Progress"
  z_oth_r_base_V "Share: Liberal"
  z_oth_r_base_SV "Share: Socialist Left"
  z_oth_r_base_Other "Share: Other" 
  z_oth_r_base_Unknown "Share: Unknown" 
  z_oth_r_base_H "Share: Conservative"   
  z_oth_r_base_g_defense "Share gender eq. defense" z_oth_r_base_g_hh "Share gender eq. hh" z_oth_r_base_i_refugee "Share positive refugee" z_oth_r_base_red_tax "Share egalitarian tax"
  z_oth_r_base_red_prop "Share egalitarian proportional" z_oth_r_base_exp_school "Share positive school exposure" z_oth_r_base_exp_conscr "Share positive conscript exposure"  
  z_oth_r_base_team_person "Share positive mixed personality"  z_oth_r_base_team_gender "Share positive mixed gender"
  z_oth_r_base_red_unemp "Share egalitarian unempl."
  z_oth_r_base_immigrant "Share immigrant background"
  			)
	prehead("\begin{tabular}{l*{2}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
		
** Table A6:

estimates drop _all

foreach var of varlist auth_a2  ///
///
{
pdslasso  `var'  authoritarian_t  (e_b_* e_a_* m_b* tr_fe*) , robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_pds
}


foreach var of varlist auth_a2    ///
///
{
reg  `var' authoritarian_t i.troop, robust
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_tr
reg  `var' authoritarian_t  e_b_* e_a_* m_b* i.troop,  robust
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_full
}



foreach var of varlist auth_a2    ///
///
{
			local varlist ///
authoritarian_t   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'_v_* 
		using "`var'_v.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		authoritarian_t "Authoritarian treatment"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	

	
** Table A7:

estimates drop _all

foreach var of varlist auth_b2  ///
///
{
pdslasso  `var'  authoritarian_t  (e_b_* e_a_* m_b* tr_fe*) , robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_pds
}


foreach var of varlist auth_b2    ///
///
{
reg  `var' authoritarian_t i.troop, robust
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_tr
reg  `var' authoritarian_t  e_b_* e_a_* m_b* i.troop,  robust
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_full
}



foreach var of varlist auth_b2    ///
///
{
			local varlist ///
authoritarian_t   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'_v_* 
		using "`var'_v.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		authoritarian_t "Authoritarian treatment"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	
		
** Table A8:

estimates drop _all


foreach var of varlist auth_a   ///
///
{
pdslasso  `var'  authoritarian_t  (m_* tr_fe*) , robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_pds
reg  `var' authoritarian_t i.troop, robust
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_tr
reg  `var' authoritarian_t  m_* i.troop,  robust
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_full
}

foreach var of varlist auth_a    ///
///
{
			local varlist ///
authoritarian_t   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'_v_* 
		using "`var'_v.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		authoritarian_t "Authoritarian treatment"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	

** Table A9:

estimates drop _all
foreach var of varlist auth_b   ///
///
{
pdslasso  `var'  authoritarian_t  (m_* tr_fe*) , robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_pds
reg  `var' authoritarian_t i.troop, robust
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_tr
reg  `var' authoritarian_t  m_* i.troop,  robust
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_v_full
}

foreach var of varlist auth_b    ///
///
{
			local varlist ///
authoritarian_t   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'_v_* 
		using "`var'_v.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		authoritarian_t "Authoritarian treatment"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	
	
** Table A10:
estimates drop _all

* Columns 1 and 3:
	foreach var of varlist auth_a auth_b ///
///
{
pdslasso  `var'  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
}

* Columns 2 and 4:
* Non_linear

foreach var of varlist auth_a auth_b ///
///
{
pdslasso  `var'  att_gr_3_1 att_gr_3_3 (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_nl_pds

}



* Table with hetero and main
				local varlist ///
	base_oth_r_att att_gr_3_1 att_gr_3_3  ///
	 
	cd "$replication"
	#delimit;
		noisily esttab auth_a_pds auth_a_nl_pds auth_b_pds auth_b_nl_pds
			using "peer_main2.tex", 
		style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("\shortstack{Support for\\authoritarian rule}" "\shortstack{Support for\\authoritarian rule}" "\shortstack{Beliefs about\\support}"  "\shortstack{Beliefs about\\support}")
			keep(`varlist') order(`varlist')
			varlabels(
		base_oth_r_att "Support for authoritarian rule in the room"
		att_gr_3_1 "Low levels in the room"
	att_gr_3_3 "High levels in the room"
	)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr


* Difference high and low (p-value)
* Column 2
pdslasso  auth_a  att_gr_3_1 att_gr_3_3 (m_b* tr_fe*) , partial(tr_fe*) cl(room)
test att_gr_3_1=att_gr_3_3
* Column 4
pdslasso  auth_b  att_gr_3_1 att_gr_3_3 (m_b* tr_fe*) , partial(tr_fe*) cl(room)
test att_gr_3_1=att_gr_3_3

* Add randomization inference p-value 
* The p-values for the randomization inference are based on 1000 perturbations of the treatment assignment. The randomization inference is for the high levels coefficient in columns 2 and 4. 

* column 1
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_a base_oth_r_att  tr_fe*  m_b_a_a_d1_m m_b_a_a_d3_m m_b_a_a_d4_m, cl(room)

/*
p=c/n= 0.0080
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1594238       8    1000  0.0080  0.0028    .00346    .015702


	   */
	   
* Column 2:
ritest att_gr_3_3 _b[att_gr_3_3], seed(19801215) reps(1000) strata(troop): reg auth_a att_gr_3_1 att_gr_3_3 m_b_a_a_d1_m m_b_a_a_d3_m m_b_a_a_d4_m m_base_mother_edu m_base_father_edu tr_fe*, cl(room)

/*
------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .2215015       1    1000  0.0010  0.0010  .0000253   .0055589
------------------------------------------------------------------------------


*/

* column 3
ritest base_oth_r_att _b[base_oth_r_att],  seed(19801215) reps(1000) strata(troop): reg auth_b base_oth_r_att  tr_fe* m_b_a_b_d1_m  m_b_a_b_d2_m m_b_a_b_d4_m  m_b_a_a_d1_m  m_b_a_a_d4_m m_base_high_pol_interest_m, cl(room)
/*

------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .1204638      38    1000  0.0380  0.0060  .0270288   .0517871
------------------------------------------------------------------------------
*/


* Column 4:
ritest att_gr_3_3 _b[att_gr_3_3], seed(19801215) reps(1000) strata(troop): reg auth_b att_gr_3_1 att_gr_3_3 m_b_a_b_d1_m m_b_a_b_d2_m m_b_a_b_d4_m m_b_a_a_d1_m m_b_a_a_d4_m m_base_high_pol_interest_m m_base_mother_edu m_base_father_edu tr_fe*, cl(room)

/*

------------------------------------------------------------------------------
T            |     T(obs)       c       n   p=c/n   SE(p) [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _pm_1 |   .2214319       0    1000  0.0000  0.0000         0   .0036821
------------------------------------------------------------------------------

*/

		 
 
 
** Table A11:
pdslasso  auth_a  base_oth_r_4_5  (m_b* tr_fe* i.n_in_room) if base_oth_r_att!=., partial(tr_fe* i.n_in_room) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su auth_a if e(sample)==1 & base_auth_4_5==1
estadd scalar count_x = r(N)
eststo base_oth_r_4_5
pdslasso  auth_a  base_oth_r_5  (m_b* tr_fe* i.n_in_room) if base_oth_r_att!=., partial(tr_fe* i.n_in_room) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su auth_a if e(sample)==1 & base_auth_5==1
estadd scalar count_x = r(N)
eststo base_oth_r_5
pdslasso  auth_a  base_oth_r_1  (m_b* tr_fe* i.n_in_room) if base_oth_r_att!=., partial(tr_fe* i.n_in_room) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su auth_a if e(sample)==1 & base_auth_1==1
estadd scalar count_x = r(N)
eststo base_oth_r_1
pdslasso  auth_a  base_oth_r_1_2  (m_b* tr_fe* i.n_in_room) if base_oth_r_att!=., partial(tr_fe* i.n_in_room) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su auth_a if e(sample)==1 & base_auth_1_2==1
estadd scalar count_x = r(N)
eststo base_oth_r_1_2

pdslasso  auth_a   base_oth_r_1_2 base_oth_r_4_5   (m_b* tr_fe* i.n_in_room) if base_oth_r_att!=., partial(tr_fe* i.n_in_room) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo base_oth_r_1_2_4_5




				local varlist ///
base_oth_r_1 base_oth_r_1_2 base_oth_r_4_5 base_oth_r_5  ///

	#delimit;
	noisily esttab base_oth_r_1 base_oth_r_1_2 base_oth_r_4_5 base_oth_r_5 base_oth_r_1_2_4_5
		using "extremists_flexn.tex", 
	style(tex) stats(mean_depvar_c N count_x Controls, labels("Mean Y in sample" "N" "N in X group""Controls")  fmt(2 0 )) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
	base_oth_r_1 "Number of people strongly disagreeing" 
	base_oth_r_1_2 "Number of people disagreeing or strongly disagreeing" 
	base_oth_r_4_5 "Number of people agreeing or strongly agreeing" 
	base_oth_r_5 "Number of people strongly agreeing" 
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
		
** Table A12:

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar max_r = r(max)
estadd scalar min_r = r(min)
eststo s_1

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean<3.4, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar max_r = r(max)
eststo s_2

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean<3.1, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar max_r = r(max)
eststo s_3

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean<3, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar max_r = r(max)
eststo s_4


	local varlist ///
base_oth_r_att   ///
  
cd "$replication"
#delimit;
	noisily esttab s_1 s_2 s_3 s_4
		using "stress_upper.tex", 
	style(tex) stats(N rooms max_r, labels("N" "Number of rooms" "Max. value in room")  fmt(0 0 2)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("Main" "S1" "S2" "S3" "S4")
		keep(`varlist') order(`varlist')
		varlabels(
		  base_oth_r_att "Support for authoritarian rule in the room"
  			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
		
** Table A13:

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>1.8, partial(tr_fe*) cl(room)
 estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_5
 
pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>1.9, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_6

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>2.19, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_7

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>2.3, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_8

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>2.49, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_9

pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>2.5, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_10
pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>2.6, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_11
pdslasso  auth_a  base_oth_r_att  (m_b* tr_fe*) if base_room_demo_a_mean>2.9, partial(tr_fe*) cl(room)
estadd scalar rooms = e(N_clust)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
su base_room_demo_a_mean if e(sample)==1 
estadd scalar min_r = r(min)
eststo s_12

		local varlist ///
base_oth_r_att   ///
  
cd "$replication"
#delimit;
	noisily esttab s_5 s_6 s_7 s_8 s_9 s_10 s_11 s_12
		using "stress_lower.tex", 
	style(tex) stats(N rooms min_r, labels("N" "Number of rooms" "Min. value in room")  fmt(0 0 2)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("S5" "S6" "S7" "S8" "S9" "S10" "S11" "S12")
		keep(`varlist') order(`varlist')
		varlabels(
		  base_oth_r_att "Support for authoritarian rule in the room"
  			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
** Table A14:


local varlist /// 
base_oth_r_att authoritarian_t base_auth_a base_auth_b base_female  base_high_pol_interest  base_high_grade  base_mother_edu  base_father_edu  base_plan_edu  base_high_risk  base_high_trust  base_vote  base_AP  base_H  base_FRP  base_V  base_SV  base_Other  base_Unknown auth_a auth_b military_rule authoritarian_pref political_order auth_a2 auth_b2 ///

cd "$replication"
estpost summarize `varlist' 
est save "desk_a", replace
eststo da





local varlist /// 
 base_oth_r_att authoritarian_t base_auth_a base_auth_b base_female  base_high_pol_interest  base_high_grade  base_mother_edu  base_father_edu  base_plan_edu  base_high_risk  base_high_trust  base_vote  base_AP  base_H  base_FRP  base_V  base_SV  base_Other  base_Unknown  auth_a auth_b military_rule authoritarian_pref political_order auth_a2 auth_b2 ///

cd "$replication"
#delimit;
esttab da using "desk_final_sample.tex",
    style(tex) /*stats(N)*/  
    cells("mean (fmt(2) pattern(1 1 1 1 1 1)) sd (fmt(2) par pattern(1 1 1 1 1 1)) ") 
	order(`varlist')
    collabels(\multicolumn{1}{c}{Mean} \multicolumn{1}{c}{SD})
	varlabels(
	  base_oth_r_att "Support for authoritarian rule in the room"
	  authoritarian_t "Authoritarian information treatment"
	  base_auth_a "Support for authoritarian rule"
	 base_auth_b "Beliefs about support in the room"
	  base_female "Female"
  base_high_pol_interest "High political interest" 
  base_high_status "High social status"
  base_high_grade "High GPA" 
  base_mother_edu "Mother with high education"
  base_father_edu "Father with high education"
  base_plan_edu "Plan higher education"
  base_high_risk "High risk"
  base_high_trust "High trust"
  base_vote  "Vote"
  base_AP "Party: Labour"  
  base_FRP "Party: Progress"
  base_V "Party: Liberal"
  base_SV "Party: Socialist Left"
  base_Other "Party: Other" 
  base_Unknown "Party: Unknown" 
  base_H "Party: Conservative"   
  auth_a "Support for authoritarian rule"
  auth_b "Beliefs about support in the room"
  military_rule "Military rule"
  authoritarian_pref "Authoritarian preferences"
  political_order "Political order"
  auth_a2 "Support for authoritarian rule"
  auth_b2 "Beliefs about support in the room"  
 	,blist(base_oth_r_att "\multicolumn{2}{l}{\emph{Treatment variables}} \\" 
				base_auth_a "\multicolumn{2}{l}{\emph{Baseline values of outcome variables}} \\"
				base_female "\multicolumn{2}{l}{\emph{Other control variables}} \\"
				auth_a "\multicolumn{2}{l}{\emph{Endline outcomes}} \\"
				auth_a2 "\multicolumn{2}{l}{\emph{Endline outcomes after information treatments}} \\"
	)
	)
	prehead("\begin{tabular}{l*{14}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
    replace;
#delimit cr




** Table A15:

reg    base_oth_r_att  m_base* m_auth_* i.troop base_tr_oth_r_att, cl(room)
eststo base_oth_r_att_bal_m 
reg    authoritarian_t  m_base* m_auth_* i.troop,  cl(room)
eststo authoritarian_t_bal_m
reg    auth_a  m_base* m_auth_* i.troop, cl(room)
eststo auth_a_bal_m

	local varlist ///
m_auth_a_base_m m_auth_b_base_m m_base*_m  ///
 
cd "$replication"
#delimit;
esttab base_oth_r_att_bal_m authoritarian_t_bal_m auth_a_bal_m using "Balance_all_missing_m.tex",
	style(tex) stats( N , labels("N")  fmt( 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("Support for authoritarian rule in room" "Authoritarian treatment" "Support for authoritarian rule")
		keep(`varlist') order(`varlist')
		varlabels(
	  base_oth_r_att "Support for authoritarian rule in the room"
	  authoritarian_t "Authoritarian information treatment"
	  m_auth_a_base_m "Support for authoritarian rule"
	 m_auth_b_base_m "Beliefs about support in the room"
	  m_base_female_m "Female"
  m_base_high_pol_interest_m "High political interest" 
  m_base_high_status_m "High social status"
  m_base_high_grade_m "High GPA" 
  m_base_mother_edu_m "Mother with high education"
  m_base_father_edu_m "Father with high education"
  m_base_plan_edu_m "Plan higher education"
  m_base_high_risk_m "High risk"
  m_base_high_trust_m "High trust"
  m_base_vote_m "Vote"
  m_base_AP_m "Party: Labour"  
  m_base_FRP_m "Party: Progress"
  m_base_V_m "Party: Liberal"
  m_base_SV_m "Party: Socialist Left"
  m_base_Other_m "Party: Other" 
  m_base_Unknown_m "Party: Unknown" 
  m_base_H_m "Party: Conservative"       
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	* Add F-test by hand
* Column 1:
reg    base_oth_r_att  m_base* m_auth_* i.troop base_tr_oth_r_att, cl(room)
testparm    m_base*_m m_auth_*_m
* Column 2:
reg    authoritarian_t  m_base* m_auth_* i.troop,  cl(room)
testparm    m_base*_m m_auth_*_m
* Column 3:
reg    auth_a  m_base* m_auth_* i.troop, cl(room)
testparm    m_base*_m m_auth_*_m

** Table A16:


foreach var of varlist military_rule authoritarian_pref political_order ///
///
{
pdslasso  `var'  base_oth_r_att  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_pds
reg  `var' base_oth_r_att i.troop base_auth_a  m_b_a_a_*, cl(room) 
	 estadd local Controls "Necessary"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_tr
reg  `var' base_oth_r_att m_b* i.troop, cl(room) 
	 estadd local Controls "Full"
su `var' if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo `var'_full
}	


		local varlist ///
base_oth_r_att   ///
 
cd "$replication"
#delimit;
	noisily esttab military_rule_pds authoritarian_pref_pds political_order_pds 
		using "peer_sec.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("Military rule" "Authoritarian preferences" "Political order")
		keep(`varlist') order(`varlist')
		varlabels(
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
	

** Table A17:

pdslasso  auth_a  z_base_oth_r_att base_oth_r_att_under base_oth_r_att_over  underestimation overestimation  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar = r(mean)
eststo ovund_auth_a
pdslasso  auth_b  z_base_oth_r_att base_oth_r_att_under base_oth_r_att_over  underestimation overestimation  (m_b* tr_fe*) , partial(tr_fe*) cl(room)
		 estadd local Controls "Lasso"
	su auth_b if e(sample)==1 
	estadd scalar mean_depvar = r(mean)
	eststo ovund_auth_b

	
						local varlist ///
	z_base_oth_r_att underestimation overestimation base_oth_r_att_under base_oth_r_att_over    ///
	 
	cd "$replication"
	#delimit;
		noisily esttab ovund_auth_a ovund_auth_b
			using "peer_hetero_uo.tex", 
		style(tex) stats(mean_depvar N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("Support"  "Beliefs")
			keep(`varlist') order(`varlist')
			varlabels(
		z_base_oth_r_att "Support for authoritarian rule in the room"
			  base_oth_r_att "Support for authoritarian rule in the room"
			  authoritarian_t_under "Treatment*underestimation" 
			  authoritarian_t_over  "Treatment*overestimation" 
			  underestimation "Underestimation" 
			  overestimation "Overestimation"
	  authoritarian_t "Authoritarian information treatment"
	  z_base_auth_a "Baseline support for authoritarian rule"
	 z_base_auth_b "Baseline beliefs"
	 base_oth_r_att_under "Support*underestimation"
	 base_oth_r_att_over "Support*overestimation"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr

		
** Table A18:

pdslasso   auth_a2  authoritarian_t authoritarian_t_under authoritarian_t_over  underestimation overestimation   (m_b* tr_fe*) , partial(tr_fe*) cl(room)
	 estadd local Controls "Lasso"
su auth_a if e(sample)==1 
estadd scalar mean_depvar = r(mean)
eststo ovund_auth_a2
pdslasso auth_b2  authoritarian_t authoritarian_t_under authoritarian_t_over  underestimation overestimation (m_b* tr_fe*) , partial(tr_fe*) cl(room)
		 estadd local Controls "Lasso"
	su auth_b if e(sample)==1 
	estadd scalar mean_depvar = r(mean)
	eststo ovund_auth_b2

	
					local varlist ///
	authoritarian_t    underestimation overestimation authoritarian_t_under authoritarian_t_over ///
	 
	cd "$replication"
	#delimit;
		noisily esttab ovund_auth_a2 ovund_auth_b2
			using "Vignette_hetero_uo.tex", 
		style(tex) stats(mean_depvar N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("Support"  "Beliefs")
			keep(`varlist') order(`varlist')
			varlabels(
		base_oth_r_att "Support for authoritarian rule in the room"
			  base_oth_r_att "Support for authoritarian rule in the room"
			  authoritarian_t_under "Treatment*underestimation" 
			  authoritarian_t_over  "Treatment*overestimation" 
			  underestimation "Underestimation" 
			  overestimation "Overestimation"
	  authoritarian_t "Authoritarian information treatment"
	  z_base_auth_a "Baseline support for authoritarian rule"
	 z_base_auth_b "Baseline beliefs"
	 htv_z_base_auth_a "Treatment*Baseline support"
	 htv_z_base_auth_b "Treatment*Baseline beliefs"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr
		
** Table A19:

foreach var of varlist auth_a auth_b ///
///
{
  foreach var2 of varlist     z_base_auth_a z_base_auth_b  ///
///
 { 
pdslasso  `var'  z_base_oth_r_att ht_`var2'  (m_b* `var2' tr_fe*), partial(tr_fe* `var2') cl(room) 
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar = r(mean)
eststo ht_`var'_`var2'
}
}


				local varlist ///
	z_base_oth_r_att  z_base_auth_a z_base_auth_b ht_z_base_auth_a ht_z_base_auth_b ///
	 
	cd "$replication"
	#delimit;
		noisily esttab ht_auth_a_z_base_auth_a ht_auth_a_z_base_auth_b ht_auth_b_z_base_auth_a ht_auth_b_z_base_auth_b
			using "peer_hetero.tex", 
		style(tex) stats(mean_depvar N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("Support" "Support" "Beliefs" "Beliefs")
			keep(`varlist') order(`varlist')
			varlabels(
		z_base_oth_r_att "Support for authoritarian rule in the room"
			  base_oth_r_att "Support for authoritarian rule in the room"
	  authoritarian_t "Authoritarian information treatment"
	  z_base_auth_a "Baseline support for authoritarian rule"
	 z_base_auth_b "Baseline beliefs"
	 ht_z_base_auth_a "Room attitudes*Baseline support"
	 ht_z_base_auth_b "Room attitudes*Baseline beliefs"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr


** Table A20:
estimates drop _all


  foreach var2 of varlist  base_female  base_high_pol_interest  base_high_grade  base_mother_edu  base_father_edu  base_plan_edu  base_high_risk  base_high_trust  base_vote  base_AP  base_H  base_FRP  base_V  base_SV  base_Other  ///
///
{
gen ht_`var2'=`var2'*z_base_oth_r_att
gen htv_`var2'=`var2'*authoritarian_t
}



  foreach var2 of varlist  base_female  base_high_pol_interest  base_high_grade  base_mother_edu  base_father_edu  base_plan_edu  base_high_risk  base_high_trust  base_vote  base_AP  base_H  base_FRP  base_V  base_SV  base_Other  ///
///
{
gen htn_`var2'=`var2'*base_oth_r_att
gen htvn_`var2'=`var2'*authoritarian_t
}

  foreach var2 of varlist  z_auth_a z_auth_b  z_base_auth_a z_base_auth_b  ///
///
{
gen htvn_`var2'=`var2'*authoritarian_t
}




foreach var of varlist auth_a2 auth_b2 ///
///
{
  foreach var2 of varlist    z_base_auth_a z_base_auth_b  ///
///
 { 
pdslasso  `var'  authoritarian_t htvn_`var2'  (m_b* `var2' tr_fe*), partial(tr_fe* `var2' ) robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1 
estadd scalar mean_depvar = r(mean)
eststo htv_`var'_`var2'
}
}


				local varlist ///
	authoritarian_t  z_base_auth_a z_base_auth_b htvn_z_base_auth_a htvn_z_base_auth_b ///
	 
	cd "$replication"
	#delimit;
		noisily esttab htv_auth_a2_z_base_auth_a htv_auth_a2_z_base_auth_b htv_auth_b2_z_base_auth_a htv_auth_b2_z_base_auth_b
			using "Vignette_hetero.tex", 
		style(tex) stats(mean_depvar N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("Support" "Support" "Beliefs" "Beliefs")
			keep(`varlist') order(`varlist')
			varlabels(
		base_oth_r_att "Support for authoritarian rule in the room"
			  base_oth_r_att "Support for authoritarian rule in the room"
	  authoritarian_t "Authoritarian information treatment"
	  z_base_auth_a "Baseline support for authoritarian rule"
	 z_base_auth_b "Baseline beliefs"
	 htvn_z_base_auth_a "Treatment*Baseline support"
	 htvn_z_base_auth_b "Treatment*Baseline beliefs"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr
		


** Table A21:

estimates drop _all

* Ordered probit: 
oprobit  auth_a base_oth_r_att i.troop m_b_a_a_*, cl(room) 
eststo op


tab auth_a
margins, dydx(base_oth_r_att) atmeans predict(outcome(1)) post
eststo op1
oprobit  auth_a base_oth_r_att i.troop m_b_a_a_*, cl(room) 
margins, dydx(base_oth_r_att) atmeans predict(outcome(2)) post
eststo op2
oprobit  auth_a base_oth_r_att i.troop m_b_a_a_*, cl(room) 
margins, dydx(base_oth_r_att) atmeans predict(outcome(3)) post
eststo op3
oprobit  auth_a base_oth_r_att i.troop m_b_a_a_*, cl(room) 
margins, dydx(base_oth_r_att) atmeans predict(outcome(4)) post
eststo op4
oprobit  auth_a base_oth_r_att i.troop m_b_a_a_*, cl(room) 
margins, dydx(base_oth_r_att) atmeans predict(outcome(5)) post
eststo op5

noisily esttab op*,  stats(N, labels("N")  fmt(0 0 2)) 	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  ///
mtitles("Coefficient" "ME 1" "ME 2" "ME 3" "ME 4" "ME 5")		keep(base_oth_r_att) order(base_oth_r_att')		varlabels(base_oth_r_att "Support for authoritarian rule in the room")


** Table A22

use "$data\replication_genpop.dta", clear
estimates drop _all

* vignette_No

reg auth_a au_t no_t, robust
	 estadd local Controls "No"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo a_a
reg auth_a au_t no_t a_group2-a_group5 female, robust
	 estadd local Controls "Yes"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo a_b


			local varlist ///
au_t no_t    ///
 
cd "$replication"
#delimit;
	noisily esttab a_a a_b
		using "vignette_No.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		au_t "Authoritarian treatment"
		antiau_t "Anti-authoritarian treatment"
		no_t "No treatment"
	a_group1 "Age 18-29"
	a_group2 "Age 30-39"
	a_group3 "Age 40-49"
	a_group4 "Age 50-59"
	a_group5 "Age 60+"
	female "Female"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

** Table A23

	estimates drop _all

reg  auth_a a_group2-a_group5 if Q5C!=., robust 
	 estadd local Controls "No"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo c_a

		local varlist ///
 a_group2 a_group3 a_group4 a_group5    ///
 
cd "$replication"
#delimit;
	noisily esttab c_a 
		using "No_control_corr.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
	a_group1 "Age 18-29"
	a_group2 "Age 30-39"
	a_group3 "Age 40-49"
	a_group4 "Age 50-59"
	a_group5 "Age 60+"
	female "Female"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
	
** Table A24

	estimates drop _all
	reg  auth_a au_t no_t, robust 
	 estadd local Group "All"
	 estadd local Controls "No"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo c2_a

reg auth_a au_t au_t_y no_t no_t_y a_group1, robust
	 estadd local Group "All"
	 estadd local Controls "Young (18-29)"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo c2_y


	
	local varlist ///
 au_t au_t_y no_t no_t_y     ///
 
cd "$replication"
#delimit;
	noisily esttab c2_a c2_y 
		using "No_control_corr_by_group_short_inter.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
	a_group1 "Age 18-29"
	a_group2 "Age 30-39"
	a_group3 "Age 40-49"
	a_group4 "Age 50-59"
	a_group5 "Age 60+"
			au_t "Authoritarian treatment"
		antiau_t "Anti-authoritarian treatment"
		no_t "No treatment"
		 no_t_y "No treatment * Young (18-29)"
		 au_t_y "Authoritarian treatment * Young (18-29)"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr


** Table A25

use  "$data\replication_multiple_countries.dta", clear


reg auth_a authoritarian_t no_t, robust
	 estadd local Controls "No"
su auth_a if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
	 estadd local Sample "All"
eststo c_a


		local varlist ///
authoritarian_t no_t    ///
 
cd "$replication"
#delimit;
	noisily esttab c_a
		using "comparative_appendix.tex", 
	style(tex) stats(mean_depvar_c N Controls Sample, labels("Mean in sample" "N" "Controls" "Sample")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		authoritarian_t "Authoritarian treatment"
		antiau_t "Anti-authoritarian treatment"
		no_t "No treatment"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr

** Table A26	

use "$data\replication_genpop.dta", clear


estimates drop _all
reg cont_demo au_t no_t, robust
	 estadd local Controls "No"
su cont_demo if e(sample)==1 
estadd scalar mean_depvar_c = r(mean)
eststo a_a
	
				local varlist ///
au_t no_t     ///
 
cd "$replication"
#delimit;
	noisily esttab a_a
		using "vignette_No_demo_short.tex", 
	style(tex) stats(mean_depvar_c N Controls, labels("Mean in sample" "N" "Controls")  fmt(2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		au_t "Authoritarian treatment"
		no_t "No treatment"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
		
** Table A27	
use "$data\replication_long.dta", clear



estimates drop _all



foreach var of varlist auth_a_ auth_b_ ///
///
{
pdslasso  `var'  w2  (m_b* tr_fe*) , partial(tr_fe*) robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1  & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_pds

}



				local varlist ///
	w2   ///
	 
	cd "$replication"
	#delimit;
		noisily esttab auth_a__pds auth_b__pds
			using "changes_main.tex", 
		style(tex) stats(mean_depvar_c mean_depvar_c2 N Controls, labels("Mean in sample in Wave 1" "Mean in sample in Wave 2" "N" "Controls")  fmt(2 2 0 2 0)) 
		starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
	mtitles("Support for authoritarian rule" "Beliefs about support")
			keep(`varlist') order(`varlist')
			varlabels(
				w2 "Wave 2"
		base_oth_r_att "Support for authoritarian rule in the room"
				)
		prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
		postfoot("\hline" "\end{tabular}")
		replace;
		#delimit cr
		



** Table A28

foreach var of varlist auth_a_  ///
///
{
pdslasso  `var'  w2  (m_b* tr_fe*) , partial(tr_fe*) robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1  & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_pds
reg  `var' w2 i.troop, robust
	 estadd local Controls "Necessary"
su `var' if e(sample)==1  & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_tr
reg  `var' w2 m_b* i.troop, robust 
	 estadd local Controls "Full"
su `var' if e(sample)==1 & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_full
}


foreach var of varlist auth_a_    ///
///
{
			local varlist ///
w2   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'* 
		using "`var'.tex", 
	style(tex) stats(mean_depvar_c mean_depvar_c2 N Controls, labels("Mean in sample in Wave 1" "Mean in sample in Wave 2" "N" "Controls")  fmt(2 2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		w2 "Wave 2"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}	

** Table A29	

		
foreach var of varlist auth_b_  ///
///
{
pdslasso  `var'  w2  (m_b* tr_fe*) , partial(tr_fe*) robust
	 estadd local Controls "Lasso"
su `var' if e(sample)==1  & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_pds
reg  `var' w2 i.troop, robust
	 estadd local Controls "Necessary"
su `var' if e(sample)==1  & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_tr
reg  `var' w2 m_b* i.troop, robust 
	 estadd local Controls "Full"
su `var' if e(sample)==1 & wave==1
estadd scalar mean_depvar_c = r(mean)
su `var' if e(sample)==1  & wave==2
estadd scalar mean_depvar_c2 = r(mean)
eststo `var'_full
}


foreach var of varlist auth_b_    ///
///
{
			local varlist ///
w2   ///
 
cd "$replication"
#delimit;
	noisily esttab `var'* 
		using "`var'.tex", 
	style(tex) stats(mean_depvar_c mean_depvar_c2 N Controls, labels("Mean in sample in Wave 1" "Mean in sample in Wave 2" "N" "Controls")  fmt(2 2 0 2 0)) 
	starlevels(* 0.10 ** 0.05 *** 0.01) b(2) se  
mtitles("" "" "" "" "")
		keep(`varlist') order(`varlist')
		varlabels(
		w2 "Wave 2"
	base_oth_r_att "Support for authoritarian rule in the room"
			)
	prehead("\begin{tabular}{l*{12}{l}}" "\hline") posthead(\hline)
	postfoot("\hline" "\end{tabular}")
	replace;
	#delimit cr
}			
		
**************** Appendix Figures ********************************

* Figure A1:


use "$data\replication_wvs.dta", clear
binscatter  auth_a_wvs S020 ,  ytitle("Support for authoritarian rule") xtitle("WVS survey year") line(qfit ) control(i.S003)
graph export "Figure_A1.pdf", replace



***************************************************************************************************************


*****Figure A.2: Support for authoritarian rule and Support for authoritarian rule in the room.

use "$data\replication_clean.dta", clear

binscatter auth_a base_oth_r_att, ytitle("Support for authoritarian rule endline") xtitle("Support for authoritarian rule in the room") control(tr_fe* b_a_a_d1 b_a_a_d2 b_a_a_d4) line(lfit) mcolor(blue%80) lcolor(gray)
graph export "Figure_A2.pdf", replace

****************************************************************************************************************


* Figure A.3: Distribution of support for authoritarian rule across samples.

use "$data\replication_genpop.dta", clear

keep auth_a no_t 
keep  if no_t==1
tempfile genpop
save `genpop'

use "$data\endline_new.dta", clear
keep base_auth_a
rename base_auth_a auth_a
gen mili=1
append using `genpop'
replace mili=0 if mili==.

twoway (histogram auth_a if mili==0, frac discrete color(white%30) lcolor(black%100) lwidth(thin)) ///        
       (histogram auth_a if mili==1, frac discrete color(%50) lcolor(black%100) lwidth(thin)), ///   
       xtitle(Support for Authoritarian Rule) legend(order(1 "Control Group in General Survey" 2 "Baseline Answers in Military Sample")) ///
	   name(Figure_A3_org, replace)
graph export "Figure_A3.pdf", replace




*****Figure A.4: Support for authoritarian rule and Support for authoritarian rule in the room

use "$data\replication_clean.dta", clear

binscatter auth_a base_oth_r_att, ytitle("Support for authoritarian rule") xtitle("Support for authoritarian rule in the room") ///
control(tr_fe* b_a_a_d1 b_a_a_d2 b_a_a_d4) mcolor(blue%80) lcolor(gray) line(qfit)
graph export "Figure_A4.pdf", replace

*****Figure A.5: Support for authoritarian rule and extreme Support for authoritarian rule in the room

use "$data\replication_clean.dta", clear

label define disag_ag1_5b 1 "Strongly disagree"  2 "Disagree" 3 "Neither nor " 4 "Agree"  5 "Strongly agree"
label values auth_* base_auth* disag_ag1_5b 


*Check if these are the correct controls to use (AAJ 09.05.2025)
binscatter diff_a base_oth_r_att, ytitle("Support for authoritarian rule") xtitle("Support for authoritarian rule in the room") ///
control(tr_fe* b_a_a_d1 b_a_a_d2 b_a_a_d4) mcolor(blue%80) lcolor(gray) line(qfit)
graph export "Figure_A5.pdf", replace



****Figure A.6: Timeline of Attitude Measurements and Experimental Design (Made in LaTex)

****Figure A.7: Distribution of the main peer treatment variable


histogram base_oth_r_att,frac color() name(Figure_A7, replace)	xtitle(Roommate attitudes: Strong leader important)
graph export "Figure_A7.pdf", replace

****************************************************************************************
*Figure A.8: Distribution of support for authoritarian rule by Authoritarian treatment in the general population.


use "$data\replication_genpop.dta", clear

drop if no_t==1

twoway ///
    (histogram auth_a if antiau_t == 1, frac discrete fcolor(white%30) lcolor(black) lwidth(thin) gap(20)) ///
    (histogram auth_a if au_t == 1, frac discrete fcolor(%50) lcolor(black) lwidth(thin) gap(20)), ///
    title("Support for Authoritarian Rule") ///
    xtitle("") ///
    ytitle("Fraction") ///
    xlabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither nor" 4 "Agree" 5 "Strongly agree", angle(0) labsize(small) nogrid) ///
    ylabel(, nogrid angle(horizontal)) ///
    legend(position(6) order(1 "Anti-authoritarian Treatment" 2 "Authoritarian Treatment") ///
           ring(1) cols(1) region(lstyle(none))) ///
    plotregion(lcolor(white)) ///
    graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
    scheme() ///
    name(Figure_A8_color, replace) xsize(4) ysize(5) scale(0.9)
graph export "Figure_A8.pdf", replace

****************************************************************************************

*Figure A.9: Distributions of answers to the support for authoritarian rule question in the general population.

use "$data\replication_genpop.dta", clear

keep if no_t==1

twoway ///
(histogram auth_a, frac discrete fcolor(%50) lcolor(black) lwidth(thin) gap(20)) , ///
    title("Support for Authoritarian Rule") ///
    subtitle("No Treatment") ///
    ytitle("Fraction") ///
	xtitle("") ///
    xlabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither nor" 4 "Agree" 5 "Strongly agree", angle(0) labsize(small) nogrid) ///
	ylabel(, nogrid angle(horizontal)) ///
    plotregion(lcolor(white)) ///
    graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
    scheme() ///
    name(Figure_A9_color, replace) xsize(4) ysize(5) scale(0.9)
graph export "Figure_A9.pdf", replace


*********************************************************************************
*Figure A.10: Effects of the Authoritarian Treatment on Support for Authoritarian Rule Across Different Samples


use "$data\replication_multiple_countries.dta", clear

encode country, gen(cc)

reg auth_a authoritarian_t no_t, robust
         estadd local Controls "No"
su auth_a if e(sample)==1
estadd scalar mean_depvar_c = r(mean)
         estadd local Sample "All"
eststo c_a

forvalues k = 1/30 {
        reg auth_a authoritarian_t no_t if cc==`k', robust
eststo c`k'
}


coefplot (c1, aseq(Argentina) pstyle(p1)) (c2, aseq(Australia) pstyle(p1)) (c3, aseq(Bangladesh) pstyle(p1))  (c4, aseq(Bolivia) pstyle(p1)) (c5, aseq(Chile) pstyle(p1)) (c6, aseq(Colombia) pstyle(p1)) (c7, aseq(Ecuador) pstyle(p1)) (c8, aseq(El Salvador) pstyle(p1)) (c9, aseq(Guatemala) pstyle(p1)) (c10, aseq(Honduras) pstyle(p1)) (c11, aseq("Hong Kong") pstyle(p1)) (c12, aseq(Kenya) pstyle(p1)) (c13, aseq(Malaysia) pstyle(p1)) (c14, aseq(Mexico) pstyle(p1)) (c15, aseq(Nicaragua) pstyle(p1)) (c16, aseq(Nigeria) pstyle(p1)) (c18, aseq(Pakistan) pstyle(p1)) (c19, aseq(Paraguay) pstyle(p1)) (c20, aseq(Peru) pstyle(p1)) (c21, aseq(Philippines) pstyle(p1)) (c22, aseq("Dominican Republic") pstyle(p1)) (c23, aseq(Singapore) pstyle(p1)) (c24, aseq("South Africa") pstyle(p1)) (c25, aseq(Tanzania) pstyle(p1)) (c26, aseq(Türkiye) pstyle(p1)) (c27, aseq(Uganda) pstyle(p1)) (c28, aseq(USA) pstyle(p1)) (c29, aseq(Venezuela) pstyle(p1)) (c30, aseq(Zambia) pstyle(p1)) (c17, aseq(Other) pstyle(p1) )  ///
 (c_a, aseq(Overall comparative)  pstyle(p3)) ///
, keep(authoritarian_t) nokey  xline(0) grid() aseq swapnames
graph export "Figure_A10.pdf", replace




****************************************************************************************************
*Figure A.11: Distributions of answers to the question in the control group of the general Norwegian population.

use "$data\replication_genpop.dta", clear


keep if no_t==1

twoway ///
    (histogram cont_demo, frac discrete fcolor(%50) lcolor(black) lwidth(thin) gap(20)), ///
    title("The Statement Contradicts" "Democratic Principles") ///
    ytitle("Fraction") ///
    xtitle("") ///
    xlabel(1 "Yes, a lot" 2 "Somewhat" 3 "Neither yes or no" 4 "Not really" 5 "Definitely not", ///
           angle(0) labsize(small) nogrid) ///
    ylabel(, nogrid angle(horizontal)) ///
    plotregion(lcolor(white)) ///
    graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
    scheme() xsize(4) ysize(5) scale(0.9) ///
    name(Figure_A11_color, replace)

graph export "Figure_A11.pdf", replace


****************************************************************************************************

*Figure A.12: Effects of the authoritarian condition versus only a statement about a strong leader

use  "$data\replication_validation.dta", clear


twoway ///
(histogram strong_leader if Treatment == 1, frac discrete ///
fcolor(white%30) lcolor(black) lwidth(thin) gap(20)) ///
(histogram strong_leader if Treatment == 0, frac discrete  ///
fcolor(%50) lcolor(black) lwidth(thin) gap(20)), ///
title("Support for Strong Leader") ///
xtitle("") ///
ytitle("Fraction") ///
xlabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither nor" 4 "Agree" 5 "Strongly agree", ///
angle(0) labsize(small) nogrid) ///
ylabel(, nogrid angle(horizontal)) ///
legend(position(6) order(1 "Full Statement" 2 "Partial Statement") ///
ring(1) cols(1) region(lstyle(none))) ///
plotregion(lcolor(white)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
scheme(stcolor) ///
name(Figure_A12_color, replace) ///
xsize(4) ysize(5) scale(0.9)
graph export "Figure_A12.pdf", replace

********************************************************************************
*Figure A.13: Effects of the authoritarian condition versus only a statement about a strong leader.


twoway ///
(histogram democratic if Treatment == 1, frac discrete ///
fcolor(white%30) lcolor(black) lwidth(thin) gap(20)) ///
(histogram democratic if Treatment == 0, frac discrete  ///
fcolor(%50) lcolor(black) lwidth(thin) gap(20)), ///
title("How Democratic" "is such a Strong-Leader System") ///
xtitle("") ///
ytitle("Fraction") ///
xlabel(1 "Very undemocratic" 9 "Very Democratic", ///
angle(0) labsize(small) ) ///
ylabel(,  angle(horizontal)) ///
legend(position(6) order(1 "Full Statement" 2 "Partial Statement") ///
ring(1) cols(1) region(lstyle(none))) ///
plotregion(lcolor(white)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
scheme(stcolor) ///
name(Figure_A13_online, replace) 
graph export "Figure_A13.pdf", replace


****************************************************************************************************
*Figure A.14: Effects of the authoritarian condition versus only a statement about a strong leader *


twoway ///
(histogram quick if Treatment == 1, frac discrete ///
fcolor(white%30) lcolor(black) lwidth(thin) gap(20)) ///
(histogram quick if Treatment == 0, frac discrete  ///
fcolor(%50) lcolor(black) lwidth(thin) gap(20)), ///
title("How likely is a strong-leader system" "to have decisive reactions") ///
xtitle("") ///
ytitle("Fraction") ///
xlabel(1 "Very unlikely" 2 "Unlikely" 3 "Unclear" 4 "Likely" 5 "Very likely", ///
angle(0) labsize(small)) ///
ylabel(, angle(horizontal)) ///
legend(position(6) order(1 "Full Statement" 2 "Partial Statement") ///
ring(1) cols(1) region(lstyle(none))) ///
plotregion(lcolor(white)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
scheme(stcolor) ///
name(Figure_A14_online, replace)
graph export "Figure_A14.pdf", replace


*A15: How likely is such a system to have a democratically elected parliament with a say in politics?


twoway ///
(histogram elected if Treatment == 1, frac discrete ///
fcolor(white%30) lcolor(black) lwidth(thin) gap(20)) ///
(histogram elected if Treatment == 0, frac discrete  ///
fcolor(%50) lcolor(black) lwidth(thin) gap(20)), ///
subtitle("How Likely is a Strong-leader System to have" "Democratically Elected Parliament with a say in Politics") ///
xtitle("") ///
ytitle("Fraction") ///
xlabel(1 "Very unlikely" 2 "Unlikely" 3 "Unclear" 4 "Likely" 5 "Very likely", ///
angle(0) labsize(small)) ///
ylabel(, angle(horizontal)) ///
legend(position(6) order(1 "Full Statement" 2 "Partial Statement") ///
ring(1) cols(1) region(lstyle(none))) ///
plotregion(lcolor(white)) ///
graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
scheme() ///
name(Figure_A15_online, replace) 
graph export "Figure_A15.pdf", replace

		
		cap log close	